{extend name="layout/default" /}
{block name="content"}
<div class="content" style="background-color: #E6F8F1;">
    <div class="bg">
        <img src="__CDN__/assets/img/bg.jpg" alt="">
    </div>
    <div class="tab">
        <ul id="lesson-tab">
            <li class="active">服务介绍</li>
            <li>可选服务</li>
        </ul>
    </div>
    <div class="content-box active">
        <div class="content-block">
            <div class="item">
                邑度营养的专业营养师团队为您提供私人、定制化的膳食管理服务，让您的健康变得触手可及！
            </div>
        </div>
    </div>
    <div class="content-box">
        <div class="content-block" id="lesson">
            {volist name="lesson" id="v"}
            <div class="lesson-item" data-price="{$v.price}" data-lesson-id="{$v.id}">
                <div class="lesson-name">
                    <h2>{$v.name}</h2>
                    <button type="button">选择</button>
                </div>
                <div class="lesson-desc">
                    {$v.desc}
                </div>
            </div>
            {/volist}
        </div>
    </div>
</div>
{/block}

{block name="footer"}
<div class="footer">
    <div class="buy-footer">
        <div class="buy-tips">
            快去选择你关注的服务吧
        </div>
        <button type="button" class="buynow" id="buynow">立即购买</button>
    </div>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
    $(function() {
        $('#lesson-tab li').click(function() {
            $(this).addClass('active').siblings().removeClass('active');
            $('.content .content-box').eq($(this).index()).addClass('active').siblings().removeClass('active');
        })
        $('.lesson-item').click(function() {
            $(this).addClass('active').siblings().removeClass('active');
            // $(this).children('.lesson-name').find('button').html('已选').siblings().children().html('选择');
            var price = $(this).data('price');
            var html = "<p>价格 <span id='lesson-price'>"+ price +"</span> 元/期</p>";
            $('.buy-tips').html(html);
        })
        $('#buynow').click(function() {
            if($('#lesson').children().hasClass('active') == true) {
                var lesson_id = $('#lesson').children('.lesson-item.active').data('lesson-id');
                window.location.href = "{:url('order/confirm')}" + "?lesson_id=" + lesson_id;
            }
        })
    })
</script>
{/block}
